package br.com.fatecpg.locacaobicicletas;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Davi
 */
public class ConexãoBike {
    

    public static java.sql.Connection ConexãoJDBC;

    public static void Conectar(String usuario,String senha)
        throws ClassNotFoundException,SQLException{
        Class.forName("oracle.jdbc.OracleDriver");
        String url = "jdbc:oracle:thin:@localhost:1521:XE";
        ConexãoJDBC = java.sql.DriverManager.getConnection(url,usuario,senha);
    }
    
    public static ResultSet executar (String sql){
        try {
            return ConexãoJDBC.createStatement().executeQuery(sql);
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null,"erro");   
            return null;
        
        }
        

    
    
    }
    public static void Desconectar() throws SQLException {
        ConexãoJDBC.close();
    }
}

//oracle.jdbc.OracleDriver